<template>
  <div>
  <el-button type="danger" @click="se">返回</el-button>
  <el-table
      ref="filterTable"
      :data="tableData"
      border
      style="width: 100%">
    <el-table-column
        type="index"
        label="题目编号"
    width="80px">
    </el-table-column>
    <el-table-column
        prop="question.question"
        label="题目">
    </el-table-column>

    <el-table-column
        prop="question.optionA"
        label="A选项">
    </el-table-column>

    <el-table-column
        prop="question.optionB"
        label="B选项">
    </el-table-column>

    <el-table-column
        prop="question.optionC"
        label="C选项">
    </el-table-column>

    <el-table-column
        prop="question.optionD"
        label="D选项">
    </el-table-column>

    <el-table-column
        prop="question.answer"
        label="正确答案">
    </el-table-column>
    <el-table-column
        prop="da"
        label="你的答案">
      <template slot-scope="scope">
      <el-tag type="success" v-if="scope.row.da==scope.row.question.answer">{{scope.row.da}}</el-tag>
      <el-tag type="danger" v-if="scope.row.da!=scope.row.question.answer">{{scope.row.da}}</el-tag>
      </template>
    </el-table-column>

  </el-table>
  </div>
</template>

<script>
import axios from "axios";
import {getRequest} from "@/utils/api";

export default {
  name: "Sstuan",
  data(){
    return{
      stuan: {},
      tableData:[]
    }
  },
  methods:{
    se(){
      this.$router.push("/sscore")
      window.sessionStorage.removeItem("stuan")
    },
    findAll(){
      this.stuan=JSON.parse(window.sessionStorage.getItem("stuan"))
        axios.post("/question/stuans",this.stuan).then(resp=>{
      this.tableData=resp.data.data;
      console.log(this.tableData)
    })
    },
  },
  created(){
    this.findAll()
  }
}
</script>

<style scoped>
</style>